package com.sqsf.mapper;

import com.sqsf.javabean.Permission;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface PermissionMapper {
    //查询所有权限
    List<Permission> selectAll();

    //添加权限
    @Insert("insert into permission (permissionName, url) values (#{permissionName}, #{url})")
    int insert(Permission permission);

    //根据id查询权限
    @Select("select * from permission where id = #{id}")
    Permission  selectById(int id);

    //根据id修改权限
    @Update("update permission set permissionName = #{permissionName}, url = #{url} where id = #{id}")
    int  updateById(Permission permission);

    //根据id删除权限
    @Delete("delete from permission where id = #{id}")
    int deleteById(int id);
}
